package cn.leelei.springmvc.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
/**
 * 实现 Controller 接口
 * @author Administrator
 *
 */
public class LoginController implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		//设置字符集
		request.setCharacterEncoding("UTF-8");
		request.setCharacterEncoding("UTF-8");
		//获得页面的提交参数
		String userName = request.getParameter("userName");
		String passWord = request.getParameter("passWord");
		
		
		ModelAndView mv= new ModelAndView();
		
		if("admin".equals(userName) && "admin".equals(passWord)){
			mv.setViewName("success");
		}else{
			mv.setViewName("fail");
		}
		return mv;
	}

}
